function Animal() {
  this.eat = function () {
    console.log("can eat");
  };
}

Animal.prototype.sleep = function () {
  console.log("sleep");
};

let animal = new Animal();
animal.sleep();

function Dog(name) {
  Animal.call(this);
  console.log(this);
  this.name = name;
  this.bark = function () {
    console.log("wong wong");
  };
}
// 将父类实例对象赋值给子类原型
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog;
let dog = new Dog("aniu");
console.log(dog);

dog.eat();
dog.sleep();

console.log(Dog.prototype.constructor, Animal.prototype.constructor);

/**寄生组合式继承 */
